@extends('layouts.back_stage')
@section('content')
    <style>
        .fabric-choose{width:100%;display:inline-block;margin-bottom:30px;}
    </style>
    <div class="container">
        {{--打印采购通知单--}}
        <div style="padding:20px 0;"><h3>打印采购通知单</h3></div>
        <div class="fabric-choose">
            <a class="btn btn-info bt_a" href="javascript:;" onclick="DaYin()">打印</a>
        </div>
        <!--startprint-->
        <style>
            .bills{width:210mm;margin:0 auto;height:auto;}
            .bills h3{text-align:center;font-size:20px;padding:20px 0;margin:0;}
            .form_ul{width:100%;height:30px;margin:0;}
            .form_li{width:33.333%;line-height:20px;float:left;font-size:14px;}
            .form_li p{display:inline-block;}
            .form_li label{width:110px;text-align:end;}
            .tab{border-collapse:collapse;width:100%;font-size:14px;color:#383838;background:#fff;margin-top:10px;}
            table td{text-align:center;height:35px;}
            table,th,td{border:1px solid #ccc;}
            .colr{color:red;}
        </style>
        <div class="bills">
            <h3>面辅料采购通知单</h3>
            <ul class="form_ul">
                <li class="form_li"><label>采购计划单号：</label><p>{{$head['plan_num']}}</p></li>
                <li class="form_li"><label>供应商：</label><p>{{$head['supplier_name']}}</p></li>
                <li class="form_li"><label>销售季节：</label><p>{{$head['sale_quarter']}}</p></li>
            </ul>
            <ul class="form_ul">
                <li class="form_li"><label>采购通知单号：</label><p>{{$head['notice_num']}}</p></li>
                <li class="form_li"><label>收货仓库：</label><p>{{$head['warehouse']}}</p></li>
                <li class="form_li"><label>审核状态：</label><p>{{$head['status']}}</p></li>
            </ul>
            <ul class="form_ul">
                <li class="form_li"><label>审核人：</label><p>{{$head['checker']}}</p></li>
                <li class="form_li"><label>审核时间：</label><p>{{$head['check_time']}}</p></li>
                <li class="form_li"><label>制单人：</label><p>{{$head['make_order_person']}}</p></li>
            </ul>
            <ul class="form_ul">
                <li class="form_li"><label>制单时间：</label><p>{{$head['make_order_time']}}</p></li>
                <li class="form_li" style="width:66.6666%"><label>开户行：</label><p>{{$head['bank_account']}}</p></li>
            </ul>
            <ul class="form_ul">
                <li class="form_li" style="width:100%;"><label>服务款号：</label><p>{{$head['server_girards']}}</p></li>
            </ul>
            <ul class="form_ul">
                <li class="form_li" style="width:100%;"><label>备注：</label><p>{{$head['remark']}}</p></li>
            </ul>
            <div>
                <table class="tab">
                    <thead>
                        <tr><td>类型</td><td>小类</td><td>厂家货号</td><td>面辅料颜色</td><td>颜色说明</td><td>面辅料规格</td><td>单价</td><td>数量</td><td>金额</td></tr>
                    </thead>
                    <tbody>
                    @if(count($content))
                        @foreach($content as $k => $v)
                            <tr><td>{{$v['type']}}</td>
                                <td>{{$v['fabric_name']}}</td>
                                <td>{{$v['fabric_num']}}</td>
                                <td>{{$v['fabric_color']}}</td>
                                <td>{{$v['colors_remark']}}</td>
                                <td>{{$v['specification']}}</td>
                                <td>{{$v['unit_price']}}</td>
                                <td>{{$v['fabric_sum']}}</td>
                                <td>{{$v['price_sum']}}</td>
                            </tr>
                        @endforeach
                    @endif
                        <tr><td colspan="7">合计</td><td class="colr">{{$total_sum['total_fabric']}}</td><td class="colr">{{$total_sum['total_price']}}</td></tr>
                    </tbody>
                </table>
            </div>
        </div>
        <!--endprint-->
    </div>
    <script>
        /*打印*/
        function DaYin() {
            preview();
        }
        function preview() {
            var bdhtml = window.document.body.innerHTML;//获取当前页的html代码
            var startStr = "<!--startprint-->";//设置打印开始区域
            var endStr = "<!--endprint-->";//设置打印结束区域
            var printHtml = bdhtml.substring(bdhtml.indexOf(startStr) + startStr.length, bdhtml.indexOf(endStr));//从标记里获取需要打印的页面
            window.document.body.innerHTML = printHtml;//需要打印的页面
            window.print();
            window.document.body.innerHTML = bdhtml;//还原界面
        }
    </script>
@endsection
